import React from 'react'
import ReactDom from 'react-dom'
import App from './App';
import {HashRouter as Router, Route, Switch, Redirect} from 'react-router-dom'
import { mainRoutes  } from './routes'
import store from './store'
import { Provider } from 'react-redux'

import zhCN from 'antd/lib/locale/zh_CN';
import { ConfigProvider } from 'antd';
import './index.css'


// import {HashRouter as Router, Route} from 'react-router-dom'

ReactDom.render(
    <Provider store={store}>
    <ConfigProvider locale={zhCN}>
            <Router>
                <Switch>
                    <Route path='/admin' component={App}/>
                    }} />
                    {
                        mainRoutes.map((item) => {
                        return <Route path={item.pathname} component={item.component} key={item.pathname} />
                        })
                    }
                    <Redirect to='/admin' from='/' exact />
                    <Redirect to='/404' />
                </Switch>
            </Router>
  </ConfigProvider>
  </Provider>
    ,
     document.querySelector('#root'))